package car4u;

public class Coniunction {
	
	public enum Type{
		MINIMUM,
		MULTIPLY,
		T_NORM
	}
	
	public Type type;
	
	public Coniunction(Type type) {
		this.type = type;
	}
	
	public double getConiunction(double x, double y){
		switch(type){
			case MINIMUM:
				return getMinimum(x, y);
				
			case MULTIPLY:
				return getMultiply(x, y);
				
			case T_NORM:
				return getTNorm(x, y);
		}
		return 0; 
	}
	
	private double getMinimum(double x, double y){
		return Math.min(x, y);
	}
	
	private double getMultiply(double x, double y){
		return x*y;
	}
	
	private double getTNorm(double x, double y){
		return Math.max(0, x+y-1);
	}
	
}
